#include "TreeNode.h"

TreeNode::TreeNode()
{
	mData = new TreeItem(0,"");
	minM=minR=NULL;
	mData=NULL;
	Right=NULL;
	Left=NULL;
	Mid=NULL;
	Parent=NULL;
	NumOfChildren=0;
}

TreeNode::TreeNode(int key,string data)
{
	mData = new TreeItem(key,data);
	minR=minM=NULL;
	Right=NULL;
	Left=NULL;
	Mid=NULL;
	Parent=NULL;
	NumOfChildren=0;
}

void TreeNode::SetData(TreeItem *item)
{
	mData->setKey(item->getKey());
	mData->setData(item->getData());
}

void TreeNode::Print() 
{
	if (mData!=NULL)
	{
		mData->printKey();
	}
}

bool TreeNode:: isLeaf()
{
	if (this!= NULL)
	{
		if (Left==NULL && Right==NULL && Mid==NULL)
			return true;
		else
			return false;
	}
	else return true;
}
//
//void TreeNode :: SaveInFile(ofstream &out_file)
//{
//	if(Data!= NULL)
//	{
//		out_file << this->GetData()->GetKey()->getNameKey()<< "  " ;
//		out_file << this->GetData()->getRank() << "  " << this->GetData()->getYears() << "\n";
//	}
//}
